package com.demo.entity;

import lombok.Data;



/**
 * @author huangChao
 **/
@Data
public class GcEntity implements AutoCloseable{
    private String name;
    // private final Cleaner.Cleanable cleanable;
    private byte[] bytes;

    public GcEntity(String name) {
        this.name = name;
        //cleanable = Cleaner.create().register(this, () -> System.out.println("执行清理 -> " + GcEntity.this.name));
    }

    public GcEntity(int dataSize) {
        this.bytes = new byte[dataSize];
    }

    @Override
    protected void finalize() throws Throwable {
        System.out.println("执行finalize方法");
    }

    @Override
    public void close() throws Exception {
        //cleanable.clean();
    }
}
